import { GCellRenderer } from "../../../../../../com/mui/controls/GCellRenderer";
import { ObjCreate } from "../../../common/ObjCreate";
import { ImagesConst } from "../../../../resource/ImagesConst";
import { GTextFormat } from "../../../../../common/GTextFormat";
import { FontUtil } from "../../../../../common/font/FontUtil";
import { SArenaCrossBattleRecord } from "../../../../../../Message/Public/SArenaCrossBattleRecord";
import { Language } from "../../../../../../extend/language/Language";
import { EntityUtil } from "../../../../scene/layer/utils/EntityUtil";
import { EBattleResult } from "../../../../../../Message/Public/EBattleResult";
import { GlobalStyle } from "../../../../../common/global/GlobalStyle";
//class ArenaCrossFinalMyBattlesCellRenderer
    
    export  class ArenaCrossFinalMyBattlesCellRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            this.initView();
            return;
        }

        /* internal  */initView(): void
        {
            ObjCreate.createBg(4, 2, 443, 2, this, ImagesConst.SplitLine);
            this._matchIndexTx = ObjCreate.createTextField("", 16, 11, 105, 20, this, new GTextFormat(FontUtil.songtiName, 12, 65535, null, null, null, null, null, flash.text.TextFormatAlign.CENTER));
            this._enemyNameTx = ObjCreate.createTextField("", 180, 11, 154, 20, this, new GTextFormat(FontUtil.songtiName, 12, 65535, null, null, null, null, null, flash.text.TextFormatAlign.CENTER));
            this._resultTx = ObjCreate.createTextField("", 403, 11, 35, 20, this);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc1=0;
            var loc2=null;
            super.data = arg1;
            this._info = arg1 as SArenaCrossBattleRecord;
            if (this._info) 
            {
                loc1 = this._info.ring;
                if (loc1 == 1 || loc1 == 2 || loc1 == 3) 
                {
                    if (loc1 != 1) 
                    {
                        if (loc1 != 2) 
                        {
                            if (loc1 == 3) 
                            {
                                this._matchIndexTx.text = Language.getStringByParam(44328, 4, this._info.battleNumInRing);
                            }
                        }
                        else 
                        {
                            this._matchIndexTx.text = Language.getStringByParam(44328, 8, this._info.battleNumInRing);
                        }
                    }
                    else 
                    {
                        this._matchIndexTx.text = Language.getStringByParam(44328, 16, this._info.battleNumInRing);
                    }
                }
                else if (loc1 != 4) 
                {
                    this._matchIndexTx.text = Language.getStringByParam(44330, this._info.battleNumInRing);
                }
                else 
                {
                    this._matchIndexTx.text = Language.getStringByParam(44329, this._info.battleNumInRing);
                }
                if (this._info.name != "") 
                {
                    this._enemyNameTx.text = "[" + EntityUtil.getProxyName(this._info.entityId) + "]" + this._info.name;
                }
                else 
                {
                    this._enemyNameTx.text = Language.getString(90084);
                }
                loc2 = this._info.result;
                if (loc2.value() != EBattleResult._EBattleResultLose) 
                {
                    if (loc2.value() != EBattleResult._EBattleResultWin) 
                    {
                        if (loc2.value() == EBattleResult._EBattleResultDraw || loc2.value() == EBattleResult._EBattleResultNULL) 
                        {
                            this._resultTx.text = " - -";
                            this._resultTx.setTextFormat(GlobalStyle.textFormatGreen);
                        }
                    }
                    else 
                    {
                        this._resultTx.text = Language.getString(44332);
                        this._resultTx.setTextFormat(GlobalStyle.textFormatGreen);
                    }
                }
                else 
                {
                    this._resultTx.text = Language.getString(44331);
                    this._resultTx.setTextFormat(new GTextFormat(FontUtil.songtiName, 12, 16711680));
                }
            }
            else 
            {
                this._matchIndexTx.text = "";
                this._enemyNameTx.text = "";
                this._resultTx.text = "";
            }
            return;
        }

        /* internal */ /* var */_matchIndexTx: Object /* flash.text.TextField */;

        /* internal */ /* var */_enemyNameTx: Object /* flash.text.TextField */;

        /* internal */ /* var */_resultTx: Object /* flash.text.TextField */;

        /* internal */ /* var */_info: SArenaCrossBattleRecord;
    }
